Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <head> <style> #myDIV { height: 250px; width: 400px; padding: 10px; margin: 15px; border-top: 15px solid black; border-left: 10px solid red; background-color: lightblue; } </style> </head> <body> <p>Click the button to get the width of the div's top and left border, in pixels.</p> <button onclick="myFunction()">Try it</button> <div id="myDIV"> <p id="demo"></p> </div> <script> function myFunction() { var elmnt = document.getElementById("myDIV"); var txt = "Border top width: " + elmnt.clientTop + "px<br>"; txt += "Border left width: " + elmnt.clientLeft + "px"; document.getElementById("demo").innerHTML = txt; } </script> </body> <!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_element_clientleft_clienttop by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:28:30 GMT --> </html>
Result:
Try it Yourself - © w3schools.com